package com.rainman.simpleredis.demo.process_flow_worker;

import com.rainman.simpleredis.core.process_flow.SimpleProcessFlowWorkerInterface;
import com.rainman.simpleredis.core.process_flow.ProcessWorkerReturn;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * 流式任务执行者
 * 座位系统
 *
 */
@Component
public class LockSitWorker implements SimpleProcessFlowWorkerInterface {


    @Override
    public ProcessWorkerReturn doWork(List<String> params) {

        System.out.println("********座位系统锁座*******"+new Date());
        System.out.println(params);

        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        ProcessWorkerReturn dealSuc = new ProcessWorkerReturn(ProcessWorkerReturn.StateSuc,"我是座位系统的锁座id");

        System.out.println("********座位系统锁座完成*******"+new Date());
        return dealSuc;

    }

    @Override
    public ProcessWorkerReturn unDoWork(List<String> params, String returnInfo) {
        System.out.println("11111111座位系统解锁");
        return null;
    }

    @Override
    public String workType() {
        return "座位系统";
    }
}
